<?php 
session_start();
if (isset($_POST['id'])){
    
   // echo json_encode(array('s'=>'go'));
    //exit;
    
    include_once("../c/config.php"); 
    
    $mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);
    if (!$mysqli->set_charset("utf8")) {printf("Error loading character set utf8: %s\n", $mysqli->error);}

    $theday=date("Y-m-d");
    $query=$mysqli->query("select count(id) as count from play where openid='".$_SESSION['openid']."' and theday='".$theday."' ");
    $getPlay=$query->fetch_array();
    $count=$getPlay['count'];
    if($count < 1){
        echo json_encode(array('s'=>'go'));
        exit;
    }
    if ($count > 1){
        echo json_encode(array('s'=>'end'));
        exit;
    }
    
    $query=$mysqli->query("select id from share where openid='".$_SESSION['openid']."' and theday='".$theday."' limit 0,1 ");
    if($query->num_rows>0){
        echo json_encode(array('s'=>'go'));
        exit;
    }else{
        echo json_encode(array('s'=>'end'));
        exit;
    }
    
    
    
}


